#!/sbin/openrc-run
supervisor="supervise-daemon"

# fallback values for /etc/conf.d/msh
: ${command_user:=msh:msh}
: ${directory:=/etc/msh}
: ${logdir:=/var/log/msh}

name=msh
description="Autostart and stop minecraft-server when players join/leave"
command="/usr/bin/msh"
command_background=true

pidfile="/run/$name.pid"
output_log="$logdir/output.log"
error_log="$logdir/error.log"

depend() {
	need net
	use logger
}

start_pre() {
	checkpath -d -o "$command_user" "$directory" "$logdir"
	checkpath -f -o "$command_user" "$output_log" "$error_log"
}
